Skip to content

[SYCL] Fix multi_ptr::prefetch regression - #19013

Merged
steffenlarsen merged 1 commit into
intel:syclfrom
AlexeySachkov:private/asachkov/fix-multiptr-prefetch-regression
Jun 20, 2025
Merged

steffenlarsen merged 1 commit into
intel:syclfrom
AlexeySachkov:private/asachkov/fix-multiptr-prefetch-regression

Conversation

@AlexeySachkov

Copy link
Copy Markdown
Contributor

The regression was introduced in #18839 and the error looks like:

/include/sycl/multi_ptr.hpp:397:5: error: no matching function for call to '__spirv_ocl_prefetch'
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
/include/sycl/multi_ptr.hpp:397:5: note: candidate function not viable: no known conversion from 'ptr_t' (aka 'const __global char *') to 'const __global signed char *' for 1st argument
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);

We previously switched to use __spirv_ocl_prefetch that is automatically defined by the compiler instead of having its forward-declaration in our headers. However, compiler-provided declaration does not define an overload for plain char for some reason.

Changing that may trigger some unknown and unwanted side effects, so for the meantime the problem is worked around by using unsigned char overload instead which should be safe (from strict aliasing rules point of view).

The regression was introduced in intel#18839 and the error looks
like:

```
/include/sycl/multi_ptr.hpp:397:5: error: no matching function for call to '__spirv_ocl_prefetch'
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
/include/sycl/multi_ptr.hpp:397:5: note: candidate function not viable: no known conversion from 'ptr_t' (aka 'const __global char *') to 'const __global signed char *' for 1st argument
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
```

We previously switched to use `__spirv_ocl_prefetch` that is
automatically defined by the compiler instead of having its
forward-declaration in our headers. However, compiler-provided
declaration does not define an overload for plain `char` for some
reason.

Changing that may trigger some unknown and unwanted side effects, so for
the meantime the problem is worked around by using `unsigned char`
overload instead which should be safe (from strict aliasing rules point
of view).

@steffenlarsen steffenlarsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@steffenlarsen
steffenlarsen merged commit 9757b4f into intel:sycl Jun 20, 2025

This branch was previously deployed

1 inactive deployment
WindowsCILock — 4592e773 Deployed Jun 17, 2025 by AlexeySachkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants